Repository navigation
fix(daemon): re-probe terminal width on every serve request - #36
Merged
Merged
Conversation
getTerminalWidth memoizes its probe process-globally, so in a long-lived --serve process a terminal resize after the first request kept serving the stale width forever, even with terminalWidthCacheTtlSeconds: 0 (80->120 resize reproduced: serve kept 80, a fresh process saw 120). Reset the memo before each request via the existing resetTerminalWidthCache seam, and add a regression test asserting the new width is picked up. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to the P2 review finding on #35:
createProcessServeDependencies().resolveTerminalWidthnow callsresetTerminalWidthCache()before each probe, so a long-lived--serveprocess picks up terminal resizes instead of serving the memoized width from the first request.Why
getTerminalWidthmemoizes its probe at process scope (hasProbed/cachedWidth), deliberately, for the one-shot-per-repaint model. In--servethe process lives across requests, so the memo never went stale-checked: an 80→120-column resize after the first request kept returning 80 on every subsequent request, even withterminalWidthCacheTtlSeconds: 0(reproduced under both Node and Bun; a fresh process correctly saw 120).Verification
serve.test.ts: setCCSTATUSLINE_WIDTH=80, resolve, set120, resolve again → 120 (fails without the reset, since the memo short-circuits before the env override).bun run lintclean.🤖 Generated with Claude Code